<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CSS计时器</title>
    <style desc="base-style">
        * {
            color: white;
            padding: 0;
            margin: 0;
            box-sizing: border-box;
            text-align: center;
        }
        
        body {
            display: grid;
            place-items: stretch;
            place-content: center;
            height: 100vh;
            width: 100vw;
            grid-template: "num num num" 64px "btn1 btn2 btn3" auto / 64px 64px 64px;
            gap: 30px 8px;
            background: #1f1f1f;
        }
        
        input {
            display: none;
        }
        
        label {
            font-size: 24px;
            border: 1px solid #cccccc;
            border-radius: 4px;
            padding: 4px;
        }
        
         :has(#start:checked) ol {
            animation-name: carousel;
        }
        
         :has(#pause:checked) ol {
            animation-name: carousel;
            animation-play-state: paused;
        }
        
         :has(#reset:checked) ol {
            animation-name: none;
        }
        
        ol {
            display: inline-block;
            animation-timing-function: steps(10);
            animation-duration: calc(var(---) * 10);
            animation-iteration-count: infinite;
        }
        
        li {
            user-select: none;
            font-size: 30px;
            display: flex;
            place-items: center;
            place-content: center;
            height: 64px;
            width: 64px;
            overflow: hidden;
        }
        
        @keyframes carousel {
            to {
                translate: 0 -100%;
            }
        }
    </style>
</head>

<body>
    <div style="grid-area: num;height: 64px;overflow: hidden;">
        <ol style="---: 100s">
            <li>0</li>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
            <li>6</li>
            <li>7</li>
            <li>8</li>
            <li>9</li>
        </ol>
        <ol style="---: 10s">
            <li>0</li>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
            <li>6</li>
            <li>7</li>
            <li>8</li>
            <li>9</li>
        </ol>
        <ol style="---: 1s">
            <li>0</li>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
            <li>6</li>
            <li>7</li>
            <li>8</li>
            <li>9</li>
        </ol>
    </div>
    <label style="grid-area: btn1">
<input type="radio" name="btn" id="start"/>开始
</label>
    <label style="grid-area: btn2">
<input type="radio" name="btn" id="pause"/>暂停
</label>
    <label style="grid-area: btn3">
<input type="radio" name="btn" id="reset" checked/>重置
</label>
</body>

</html>